package cn.usts.edu.lesson01;

import java.awt.*;

public class TestGridLayOut {
    // 表格布局
    public static void main(String[] args) {
        Frame frame = new Frame("GridLayOut");
        frame.setVisible(true);

        // 按钮组件
        Button button1 = new Button("button1");
        Button button2 = new Button("button2");
        Button button3 = new Button("button3");
        Button button4 = new Button("button4");
        Button button5 = new Button("button5");
        Button button6 = new Button("button6");

        // 设置布局形式为表格布局
        frame.setLayout(new GridLayout(2,3));

        frame.add(button1);
        frame.add(button2);
        frame.add(button3);
        frame.add(button4);
        frame.add(button5);
        frame.add(button6);

        // 自动调整为合适大小
        frame.pack();
    }
}
